<?php 

require 'header.php';
$action=isset($_GET['a'])?$_GET['a']:'index';
switch ($action) {
	case 'add':
		if(IS_POST){
			$file=upload();
			foreach ($file as $k => $v) {
				$file[$k]['cid']=$_POST['cid'];
			}
			if (addImage($file)) {
				success('添加图集成功');
			}
		}else{
			require 'view/add.html';
		}
		break;
		case'index';
		default:
		require'view/index.html';
}

 ?>